﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fit2ModelsFluent
{
    public class AnswerRepositoryFactory
    {
        
        //meant to be set on application start
        public static Func<IAnswerRepository> RepositoryBuilder =
            CreateDefaultRepositoryBuilder;

        private static IAnswerRepository CreateDefaultRepositoryBuilder()
        {
            //throw if factory not initialized
            throw new Exception("No repository builder specified.");
        }

        public IAnswerRepository BuildRepository()
        {
            //Uses the Func<IQuestionRepository> to build the instance
            IAnswerRepository repository = RepositoryBuilder();
            return repository;
        }
    }
}
